<template>
  <div
    :class="{ base_title: true, padding_small: showRightTop && showRightBottom }"
    :style="{ 'background-color': bgColor }"
  >
    <div class="left-title">
      <img class="base-icon" :src="titleIcon" />
      <div class="font-common">
        {{ title }}
      </div>
    </div>
    <div class="right-text">
      <div class="rightTop" v-if="showRightTop">
        {{ rightTop }}
      </div>
      <div class="rightBottom" v-if="showRightBottom">
        {{ rightBottom }}
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "PageTitle",
  props: {
    titleIcon: {
      type: String,
      default: "",
    },
    title: {
      type: String,
      default: "",
    },
    bgColor: {
      type: String,
      default: "",
    },
    rightTop: {
      type: String,
      default: "",
    },
    rightBottom: {
      type: String,
      default: "",
    },
    showRightTop: {
      type: Boolean,
      default: false,
    },
    showRightBottom: {
      type: Boolean,
      default: false,
    },
  },
};
</script>

<style lang="less" scoped>
.base_title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  width: 250px;

  .left-title {
    display: flex;

    .base-icon {
      width: 15px;
      height: 15px;
      margin-left: 11px;
      margin-right: 8px;
    }
  }

  .right-text {
    margin-right: 10px;
    font-size: 12px;
    font-weight: 500;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    .rightTop {
      margin-bottom: 2px;
    }
  }

  .font-common {
    font-size: 16px;
    font-weight: 500;
    color: #fff;
  }
}
.padding_small {
  padding: 4px 0;
}
</style>
